<?php

class Tag_ListController extends Zend_Controller_Action
{

    public function init()
    {
        Zend_Registry::get('layout')->setLayout('duty');
        
        $activeResource=Application_Model_Tags::RESOURCE_NAME;
        
        // seting active resource
        Zend_Registry::set('resource',$activeResource);

        $this->view->headTitle()->append(Zend_Registry::get('locale')->_('Tags'));
        
        $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
        $this->view->flash_messages = $this->_flashMessenger->getMessages();
    }

    public function indexAction()
    {
        if (!Zend_Registry::get('user')->canView())
        {
            return $this->_helper->redirector('index');
        }
        
        $key=(int) $this->_getParam('key');
        
        $tagTbl=new Application_Model_TagsDb();

        list($tags,$paginator)=$tagTbl->getTagsPage($key,20);
       
        $this->view->tags=$tags;
        $this->view->paginator=$paginator;
    }


}

